// define the rbr plugin interface, trait is the interface in rust

use std::os::raw::c_char;

#[allow(non_snake_case, dead_code, non_camel_case_types)]
#[repr(C)]
pub enum ERBRTyreTypes {
    TYRE_TARMAC_DRY, 
    TYRE_TARMAC_INTERMEDIATE,
    TYRE_TARMAC_WET, 
    TYRE_GRAVEL_DRY,		
    TYRE_GRAVEL_INTERMEDIATE,
    TYRE_GRAVEL_WET,
    TYRE_SNOW,
    NUM_TYRE_TYPES,
    TYRE_TYPE_FORCE_DWORD = 0x7fffffff,
}

#[allow(non_snake_case, dead_code, non_camel_case_types)]
#[repr(C)]
pub enum ERBRWeatherType {
    GOOD_WEATHER,
    RANDOM_WEATHER,
    BAD_WEATHER,
}

#[allow(non_snake_case, dead_code, non_camel_case_types)]
#[repr(C)]
pub enum EFonts
{
    FONT_SMALL,
    FONT_BIG,
    FONT_DEBUG,
    FONT_HEADING, // Only uppercase
}

#[allow(non_snake_case, dead_code, non_camel_case_types)]
#[repr(C)]
pub enum EMenuColors
{
    MENU_BKGROUND,  // Background color
    MENU_SELECTION, // Selection color
    MENU_ICON,      // icon color
    MENU_TEXT,      // text color
    MENU_HEADING,	// heading color
}

#[allow(non_snake_case, dead_code, non_camel_case_types)]
#[repr(C)]
pub enum EGameLanguage
{
    L_ENGLISH,
    L_FRENCH,		
    L_GERMAN,
    L_SPANISH,
    L_ITALIAN,
    L_CZECH,
    L_POLISH,
    L_NUM_LANGUAGES
}



#[allow(non_snake_case, dead_code, non_camel_case_types)]
pub trait IPlugin {
    fn GetName(&mut self) -> *const c_char;
    fn DrawFrontEndPage(&mut self);
    fn DrawResultsUI(&mut self);
    fn HandleFrontEndEvents(&mut self, txtKeyboard: c_char, bUp: bool, bDown: bool, bLeft: bool, bRight: bool, bSelect: bool);
    fn TickFrontEndPage(&mut self, fTimeDelta: f32);
    fn StageStarted(&mut self, iMap: i32, ptxtPlayerName: *const c_char, bWasFalseStart: bool);
    fn HandleResults(&mut self, fCheckPoint1: f32, fCheckPoint2: f32, fFinishTime: f32, ptxtPlayerName: *const c_char);
    fn CheckPoint(&mut self, fCheckPointTime: f32, iCheckPointId: i32, ptxtPlayerName: *const c_char);
}


#[allow(non_snake_case, dead_code)]
pub trait IRBRGame {
    fn StartGame(&mut self, iMap: i32, iCar: i32, eWeather: ERBRWeatherType, eTyre: ERBRTyreTypes, ptxtPlayerName: *const c_char);
    fn WriteGameMessage(&mut self, ptxtMessage: *const c_char, fTimeToDisplay: f32, x: f32, y: f32);

    // menu draw functions
    fn WriteText(&mut self, x: f32, y: f32, ptxtText: *const c_char);
    fn DrawBox(&mut self, iBox: u32, x: f32, y: f32);
    fn DrawFlatBox(&mut self, x: f32, y: f32, w: f32, h: f32);
    fn DrawBlackOut(&mut self, x: f32, y: f32, w: f32, h: f32);
    fn DrawSelection(&mut self, x: f32, y: f32, w: f32, h: f32);
    // fn DrawSelection(&self, x: f32, y: f32, w: f32);   // h = 21.0
    fn DrawCarIcon(&mut self, x: f32, y: f32, iCar: i32);

    fn SetDrawMode(&mut self, bfDrawMode: u32);
    fn ReSetDrawMode(&mut self, bfDrawMode: u32);

    fn SetFont(&mut self, eFont: EFonts);

    fn SetMenuColor(&mut self, eColor: EMenuColors);
    fn SetColor(&mut self, r: f32, g: f32, b: f32, a: f32);

    fn GetLanguage(&mut self) -> EGameLanguage;
}
